package com.meituan.catering.management.product.biz.model.converter;

import com.google.common.collect.Lists;
import com.meituan.catering.management.product.biz.model.ProductAccessoryBO;
import com.meituan.catering.management.product.dao.model.ProductAccessoryDO;
import org.apache.commons.collections4.CollectionUtils;

import java.util.Collections;
import java.util.List;

/**
 * @author Believe
 * Date 2022/5/22 16:27
 */
public class ProductAccessoryBOConverter {
    public static List<ProductAccessoryBO> toProductAccessoryBO(List<ProductAccessoryDO> accessoryDOList) {
        if (CollectionUtils.isEmpty(accessoryDOList)) {
            return Collections.emptyList();
        }
        List<ProductAccessoryBO> accessoryBOList = Lists.newLinkedList();
        for (ProductAccessoryDO productAccessoryDO : accessoryDOList) {
            ProductAccessoryBO accessoryBO = new ProductAccessoryBO();
            accessoryBO.setId(productAccessoryDO.getId());
            accessoryBO.setProductId(productAccessoryDO.getProductId());
            accessoryBO.setTenantId(productAccessoryDO.getTenantId());
            accessoryBO.setGroupName(productAccessoryDO.getGroupName());
            accessoryBO.setName(productAccessoryDO.getName());
            accessoryBO.setUnitPrice(productAccessoryDO.getUnitPrice());
            accessoryBO.setUnitOfMeasure(productAccessoryDO.getUnitOfMeasure());
            accessoryBOList.add(accessoryBO);
        }
        return accessoryBOList;
    }

}
